﻿using Report_IService.Web;
using Report_Model.Web;
using Report_Service.Web;
using Report_Unity.Basic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace ReportWebApi.Controllers.Api.WeiXin
{
    [RoutePrefix("api/Admin")]
    public class AdminController : BaseApiController
    {
        private IAdminService AdminService = new AdminService();


        [HttpGet, Route("GetLoginTicket")]
        public ResultInfo GetLoginTicket()
        {
            string hid = new SuperUser().userid;
            ResultInfo res = AdminService.GetLoginTicket(hid);
            return res;
        }

        [HttpPost, Route("LoginSuper")]
        public ResultInfo LoginSuper()
        {
            var req = HttpContext.Current.Request;
            string username = req.Form["username"];
            string pwd = req.Form["pwd"];
            string ticket = req.Form["ticket"];
            string code = req.Form["code"];

            ResultInfo res = AdminService.LoginSuper(username, pwd, ticket, code);
            return res;
        }

    }
}
